<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"   
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   template="/WEB-INF/templates/default.xhtml">
   
   	<f:metadata>	   	
	   	<f:viewParam name="firstResult" value="#{serviceSupplierManageList.firstResult}"></f:viewParam>	
	   	<f:viewParam name="moduleName" value="中介用户管理"></f:viewParam>
	   	<f:viewParam name="supplierName" value="#{serviceSupplierManageList.cnname}"></f:viewParam>
	   	<f:viewParam name="minScore" value="#{serviceSupplierManageList.minScore}"></f:viewParam>
	   	<f:viewParam name="maxScore" value="#{serviceSupplierManageList.maxScore}"></f:viewParam>
		<f:viewParam name="region" value="#{serviceSupplierManageList.region}"></f:viewParam>
   		<f:viewParam name="auditStatus" value="#{serviceSupplierManageList.parameterValues['auditStatus']}"></f:viewParam>
   	</f:metadata>
   
   	<ui:define name="content">
   
		<h:form id="searchForm">
			<div style="min-height:50px;margin:10px">
				<p:outputLabel value="中介名称："></p:outputLabel>				
				<p:inputText value="#{serviceSupplierManageList.cnname}"></p:inputText>
				#{'    '}
				<p:outputLabel value="信用分："></p:outputLabel>
				<p:inputNumber value="#{serviceSupplierManageList.minScore}"></p:inputNumber>
				-
				<p:inputNumber value="#{serviceSupplierManageList.maxScore}"></p:inputNumber>
				#{'    '}
				<p:outputLabel value="审核状态："></p:outputLabel>				
				<p:selectOneMenu style="position: relative;top: 0px;" value="#{serviceSupplierManageList.parameterValues['auditStatus']}">
								<f:selectItem itemLabel="请选择" itemValue="#{null}"  />
								<f:selectItem itemLabel="未审核" itemValue="#{2}" />
								<f:selectItem itemLabel="审核成功" itemValue="#{1}" />
								<f:selectItem itemLabel="审核失败" itemValue="#{0}" />
				</p:selectOneMenu>
				#{'    '}
				<p:outputLabel value="所属县区：" style="display: inline-block;margin-top: 5px;"></p:outputLabel>
				<p:selectOneMenu id="region"
								 value="#{serviceSupplierManageList.region}">
					<f:selectItem itemLabel="请选择" itemValue="#{null}"  />
					<f:selectItems value="#{codeDicUtils.getCodeDicList('所在地区')}" var="_codeDic" itemValue="#{_codeDic.codeValue}"
								   itemLabel="#{_codeDic.codeName}" />
				</p:selectOneMenu>
				<div style="margin-top:10px;">
					<div class="actionButtons">
						<p:commandButton value="查询" ajax="false"   action="ServiceSupplierList.xhtml?faces-redirect=true&amp;includeViewParams=true&amp;firstResult=0" styleClass="blue-int"></p:commandButton>
						<p:button value="重置" outcome="ServiceSupplierList.xhtml"></p:button>
					</div>
					<p:link styleClass="btn" href="/rest/serviceSupplier/supplierContactsExport" value="导出入驻中介机构联络单" />
				</div>

				<div class="clearbt"></div>
			</div>
			
			<p:panel id="searchResult">
				<f:facet name="header">中介用户管理</f:facet>
				<p:dataTable value="#{serviceSupplierManageList.resultList}" var="_serviceSupplier">
					
					<p:column>
						<f:facet name="header">名称</f:facet>
						#{_serviceSupplier.cnname}
					</p:column>
					
					<p:column>
						<f:facet name="header">用户名</f:facet>
						#{_serviceSupplier.username}
					</p:column>
					
					<p:column width="70">
						<f:facet name="header">联系人</f:facet>
						#{_serviceSupplier.firstContactor}
					</p:column>
					
					<p:column width="100">
						<f:facet name="header">联系电话</f:facet>
						#{_serviceSupplier.firstContactorPhoneNumber}
					</p:column>
					<p:column width="60">
						<f:facet name="header">信用分</f:facet>
						#{_serviceSupplier.creditScore}
					</p:column>
					<p:column>
						<f:facet name="header">联系地址</f:facet>
						#{_serviceSupplier.address}
					</p:column>
					<p:column>
						<f:facet name="header">所属县区</f:facet>
						#{codeDicUtils.getCodeDicValueKeyMap('所在地区')[_serviceSupplier.region]}
					</p:column>
					<p:column>
						<f:facet name="header">审核状态</f:facet>
						<ui:include src="/WEB-INF/templates/outputBoolean.xhtml">
							<ui:param name="booleanValue" value="#{_serviceSupplier.auditted}" />
						</ui:include>
					</p:column>
					<p:column>
						<f:facet name="header">审核时间</f:facet>
						<h:outputText value="#{_serviceSupplier.auditDate}" >
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss"/>
						</h:outputText>
					</p:column>
					<p:column>
						<f:facet name="header">注册时间</f:facet>
						<h:outputText value="#{_serviceSupplier.createDate}" >
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss"/>
						</h:outputText>
					</p:column>
					<p:column>
						<f:facet name="header">审核人</f:facet>
						#{_serviceSupplier.auditUser.cnname}
					</p:column>
					<p:column>
						<f:facet name="header">最近修改时间</f:facet>
						<h:outputText value="#{_serviceSupplier.lastUpdateDate}" >
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss"/>
						</h:outputText>
					</p:column>
					<p:column>
						<f:facet name="header">修改人</f:facet>
						<h:outputText value="#{_serviceSupplier.updateBy}" />
					</p:column>
					<p:column style="text-align: center" width="120">
						<f:facet name="header">操作</f:facet>
						<p:button value="修改" outcome="ServiceSupplierEdit.xhtml">
							<f:param name="serviceSupplierId" value="#{_serviceSupplier.id}"></f:param>
						</p:button>
						<p:button value="审核" outcome="ServiceSupplierAudit.xhtml" rendered="#{empty _serviceSupplier.auditted}">							
							<f:param name="serviceSupplierId" value="#{_serviceSupplier.id}"></f:param>
						</p:button>
						<p:button value="查看" outcome="ServiceSupplierView.xhtml" rendered="#{not empty _serviceSupplier.auditted}">							
							<f:param name="serviceSupplierId" value="#{_serviceSupplier.id}"></f:param>
						</p:button>	
						<p:button value="重置密码" outcome="ResetPassword.xhtml" rendered="false">
							<f:param name="userId" value="#{_serviceSupplier.id}"></f:param>
						</p:button>
						<p:button value="用户名修改" outcome="UserEdit.xhtml" rendered="#{request.isUserInRole('developer')}">
							<f:param name="userId" value="#{_serviceSupplier.id}"></f:param>
						</p:button>
						<ui:remove>	
							<p:button value="重关联" outcome="/manage/system/reCreateAgentServiceRelationship.xhtml" target="_blank" rendered="#{request.isUserInRole('developer')}">
								<f:param name="serviceSupplierId" value="#{_serviceSupplier.id}"></f:param>
							</p:button>
						</ui:remove>				
					</p:column>
				</p:dataTable>
			</p:panel>
			
			<ui:include src="/WEB-INF/templates/manage/pagination.xhtml">
				<ui:param name="entityList" value="#{serviceSupplierManageList}" />
			</ui:include>
			
		</h:form>
      	<script type="text/javascript">
			var contextPath = '${request.getContextPath()}';
			$(function(){	
				
			})
		</script>
   	</ui:define>
</ui:composition>
